{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑{if $info.user_type == 2}经纪人{else /}设计师{/if}</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <input type="hidden" name="user_id" value="{$info.user_id}">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">{if $info.user_type == 2}经纪人{else /}设计师{/if}名称：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.user_username}" name="user_name" lay-verify="required" placeholder="经纪人名称" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">联系方式：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.user_phone}" name="user_phone" lay-verify="required" placeholder="联系方式" class="layui-input ">
                            </div>
                        </div>
                        {if $info.user_type == 2}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">门店信息：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.user_shop}" name="user_shop" lay-verify="required" placeholder="门店信息" class="layui-input ">
                            </div>
                        </div>
                        {else /}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">公司信息：</label>
                            <div class="layui-input-block">
                                <select name="user_shop" lay-search="" lay-verify="required">
                                    <option  value="">请选择公司</option>
                                    {volist name='coms' id='c'}
                                    <option  value="{$c['id']}" {if $c['id']==$info['user_company_id_3']} selected {/if}>{$c.name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        {/if}

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">头像：</label>
                            <input type="hidden" name="user_image" id="lay-img" lay-verify="image" value="{$info.user_image}">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                        <img class="layui-append-img" src="{$info.user_image}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">身份证正面：</label>
                            <input type="hidden" name="user_zheng" id="lay-img4" lay-verify="image" value="{$info.user_zheng}">
                            <div class="layui-input-block">
                                <div id="lay-upload4">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list4">
                                        <img class="layui-append-img" src="{$info.user_zheng}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">身份证反面：</label>
                            <input type="hidden" name="user_fan" id="lay-img1" lay-verify="image" value="{$info.user_fan}">
                            <div class="layui-input-block">
                                <div id="lay-upload1">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list1">
                                        <img class="layui-append-img" src="{$info.user_fan}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">名片：</label>
                            <input type="hidden" name="user_card" id="lay-img2" lay-verify="image" value="{$info.user_card}">
                            <div class="layui-input-block">
                                <div id="lay-upload2">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list2">
                                        <img class="layui-append-img" src="{$info.user_card}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">营业执照：</label>
                            <input type="hidden" name="user_zhizhao" id="lay-img3" lay-verify="image" value="{$info.user_zhizhao}">
                            <div class="layui-input-block">
                                <div id="lay-upload3">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list3">
                                        <img class="layui-append-img" src="{$info.user_zhizhao}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">省：</label>
                            <div class="layui-input-block">
                                <select name="b_sheng" lay-search="" id="province"  lay-filter="province">
                                    <option value="">---- 请选择省 ----</option>
                                    {foreach name="province" item="v1"}
                                    <option value="{$v1.district_id}" {$info.user_sheng == $v1.district_id ? 'selected' : ''}>{$v1.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">市：</label>
                            <div class="layui-input-block">
                                <select name="b_shi" lay-search=""  id="city"  lay-filter="city">
                                    {foreach name="city" item="v2"}
                                    <option value="{$v2.district_id}" {$info.user_shi == $v2.district_id ? 'selected' : ''}>{$v2.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">区：</label>
                            <div class="layui-input-block">
                                <select name="b_qu" lay-search=""  id="district"  lay-filter="district">
                                    {foreach name="district" item="v3"}
                                    <option value="{$v3.district_id}" {$info.user_qu == $v3.district_id ? 'selected' : ''}>{$v3.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="usertypehref" value="{$info.user_type}">
{include file="public/footer" /}
<script>
    var editor = wk.wang({elem:'#LAY_editor'});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:"",num:1});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:"",num:2});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:"",num:3});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:"",num:4});
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.verify({
            image:[/\S/,'请上传图片'],
            editor:function(value,item){
                if(editor.txt.html() == '<p><br></p>'){
                    return '请填写内容';
                }
            }
        });
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('brokerEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        var tt = $('#usertypehref').val();
                        if(tt == 2){
                            wk.success(res.msg,"{:url('Broker/index')}")
                        }else{
                            wk.success(res.msg,"{:url('Broker/designs')}")
                        }

                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>
</body>
</html>
